EngineBuffer: Reset sample counter after indicator update#16245
EngineBuffer: Reset sample counter after indicator update#16245alajovic wants to merge 2 commits intomixxxdj:2.5from
Conversation
8fa2556 to
bef0af3
Compare
|
Eh. Missed the fact that this member variable had been renamed between 2.5 and 2.6, and I committed the fix with 2.6 name to 2.5. Surprise – it didn't build. Fixed that now. |
|
Thank you. |
|
@ronso0 Fair point, but that's a separate issue. The mapping itself is in need of a modernization. I have recently gotten a DDJ-SX and mixxx logged warnings becuse the mapping was still using That sample counter is a parallel issue — the counter exists, but it starts off uninitialized (it's assigned only in setNewPlaypos) and is never reset. I think there's a fair chance that the respective code was simply lost during refactoring. |
|
I agree to both. Will take a look at this soonish. |
|
Though CI fails (on some targets onl??) because the engine somehow relies on the current behavior? |
|
Maybe we need to keep |
|
|
|
Some CI targets indeed failed, and the pattern seems random. Almost as if it were some kind of a timing issue. 😁 I'll look into this. |
|
Tests assume that a call to Not sure how to proceed. On one hand, it sounds sensible to keep |
|
@alajovic you're right, ¹ corresponds to buffer size, or "engine process rate", which may be up to 750 Hz with minimal buffer of 1.33 ms Btw IIUC this also calls
@alajovic as a quick fix for your mapping issue I suggest you move @daschuer maybe you can shed a light on this? |
|
I can confirm that this is an issue and the fix looks good. However we need to fix the tests as well. |
This requires to either make tests wait for the same period, or add another CO that is always accurate. |
|
I looks like this is a regression in #1963 Accurate is relative in a multithreading environment. No one want to run another thread in 1 ms outside of the engine thread. This means anything that was added after that might be assume the fast update rate and my suffer from a regression after merging that. Ok, so you are right, we need to look at this in a bigger scope. Maybe not a 2.5 bug fix. |
|
Thanks for your comments. If I understand correctly, some parts of the code may actually depend on
|
|
Yes, let's go for 2. But without a new CO. Using a CO with an down to 1000 Hz update rate is even an issue for the GUI thread delivering the update signals. There is also a even locking involved, unfortunately. So the removal of it here will be a major win for low latency setups. From the threading theory, there can't also be a need by other asyncron tasks for updates that right rate. Assuming that processing in a non RT thread is anyway done suffering suspention by the RT thread advancing the play position behind its back. Because of this it can be always considered as "old". It does not matter how "old' it is for the workaround code. For timed play position, we have already the visual play position code. So we may keep using the 15 Hz update rate or refactor the code to use visual play position. |
|
I have found these places in the code: Productive code: Open? Refactor to visual play position? mixxx/src/vinylcontrol/vinylcontrolxwax.cpp Line 324 in 01a689c Visual, 15 Hz OK: mixxx/src/widget/woverview.cpp Line 80 in 952e329 Visual, 15 Hz OK: mixxx/src/widget/wspinnybase.cpp Line 34 in 01a689c Used to set a cue point. Doing it while playing will use a delayed CU point. User is not that fast is OK. mixxx/src/widget/wcuemenupopup.cpp Line 196 in 952e329 Running Auto DJ with 15 Hz is desired. Unittests: Various unittest do a single Engine call and check the playosition. Maybe similar to here: mixxx/src/test/mockedenginebackendtest.h Line 74 in 952e329 Alterntive is to set |
|
@jclsn can you also have a look and confirm? I think we need to immediately after This can also be used for testing BTW. |
|
@daschuer I honestly don't understand what this is about. I haven't read the vinylcontrolprocessor that closely. |
|
@daschuer What about if we replace this: mixxx/src/vinylcontrol/vinylcontrol.h Lines 36 to 37 in 30b4008 with QSharedPointer<VisualPlayPosition> m_visualPlayPos;and then in constructor m_visualPlayPos(VisualPlayPosition::getVisualPlayPosition(group))and then in That would be a fairly minimal intervention. Do you see any potential problems with it? |
|
That's a good solution. Go ahead. |
|
I have implemented the suggested approach, please review. One pipeline check is failing, but it looks like it triggers on code that wasn't changed in the scope of my commits. |
|
Since this can become a perfomance issue I have assigned it to the 2.6 milestone. |
|
Should I rebase onto 2.6 or is it fine if it stays as it is? |
Playpos indicator updates in EngineBuffer are supposed to happen with a rate of 15 Hz:
mixxx/src/engine/enginebuffer.cpp
Line 53 in 3ebac44
There is a counter that takes track of this:
mixxx/src/engine/enginebuffer.h
Line 379 in 3ebac44
but it is never reset after an update:
mixxx/src/engine/enginebuffer.cpp
Lines 1477 to 1482 in 3ebac44
As a result, playpos updates are issued at a rate much faster than 15 Hz. I noticed this because the DDJ-SX mapping relies on those 15 Hz to blink the jog dial when the end of a track approaches, and the blinking was way too fast and erratic.
It seems that the counter reset was accidentally removed in 5a4444d. I added it back. The issue is present both in 2.5 and 2.6, so the fix targets 2.5.